home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / storm100.lzh / STRT_1.BAS < prev    next >
BASIC Source File  |  1993-11-04  |  3KB  |  119 lines

  1. ' STRT_1.BAS  GRMEYER v1.1 10/30/93
  2. ' Automates logging onto GEnie's ST RT BB, Library, RTC, or email
  3. ' If this is accidently invoked while online it will MOVE to the destination
  4. ' REQUIRES:
  5. '  - Dialing entry of "GEnie" with correct phone number. Note that settings
  6. '    and autologon for this entry are ignored, they're handled by script.
  7. '  - ASCII file named GENIE.PWD in Storm directory. Contains ACCOUNT & PASSWD
  8. '    each on own line terminated with a carriage return
  9. '
  10. ' == Initialzation ==
  11. READ n
  12. DIM p$(n),c$(n)
  13. FOR x = 1 to n
  14.     READ p$(x),c$(x)
  15. NEXT x
  16. '
  17. IF CARRIER THEN
  18.   title$=" Move to... "
  19. ELSE
  20.   title$=" Logon to... "
  21. ENDIF
  22. ' == Mainline ==
  23. dest = POPUP (1,title$,p$(1),p$(2),p$(3),p$(4),p$(5))
  24. '
  25. IF dest = 5 THEN GOTO EXIT:' 'cancel' was the selection
  26. IF CARRIER THEN
  27.     SEND c$(dest)
  28. ELSE
  29.     gosub logon
  30. ENDIF
  31. GOTO EXIT
  32. '
  33. ' == Finalization ==
  34. EXIT:
  35.     END
  36. '
  37. ' == logon subroutine ==
  38. logon:
  39. ' this routine searches the dialing dir for entry "GEnie", gets the
  40. ' phone number, then handles the dialing, connecting, and logging on
  41. ' we'll jump straight to exit if an error is detected
  42. '
  43. entry$="0":' init the entry number of "GEnie" in the dialing dir
  44. '            if this stays zero we didn't find the entry
  45. temp$=""
  46. nent$=SET$("STORM","Dialer","Entries"):' find # of entries in dial dir
  47. FAST ON
  48. FOR x = 1 to val(nent$)
  49.     temp$=SET$("DIALDIR",str$(x),"Name")
  50.     IF temp$ = "GEnie" THEN entry$=str$(x)
  51. NEXT x
  52. FAST OFF
  53. IF entry$="0" THEN
  54.     TOPW:PRINT "Error: No entry found for GEnie!";:PRINT chr$(7)
  55.     GOTO EXIT
  56. ENDIF
  57. '
  58. ' get our genie password and account. If file doesn't exist we'll error off
  59. OPEN "r",#1,"GENIE.PWD":' it'd be nice to do a fsfirst() here but oh well
  60. INPUT #1,acct$
  61. INPUT #1,pwd$
  62. CLOSE #1
  63. '
  64. ' set up some known settings for GEnie then read STORM.INI for specifics
  65. ' about the modem setup
  66. DUPLEX HALF
  67. BAUD 2400
  68. SBITS 1
  69. PARITY NONE
  70. prefix$=SET$("STORM","Modem","Prefix"):' dialing prefix
  71. con1$=SET$("STORM","Modem","Connect1")
  72. con2$=SET$("STORM","Modem","Connect2")
  73. fail1$=SET$("STORM","Modem","Fail1")
  74. fail2$=SET$("STORM","Modem","Fail2")
  75. timeout=SET("STORM","Modem","Timeout"):' get dialing timeout value
  76. IF con1$="" THEN con1$="XXXXXXXXXXXXX":'just in case these are empty
  77. IF con2$="" THEN con2$="XXXXXXXXXXXXX":'if they are empty, wait() will
  78. IF fail1$="" THEN fail1$="XXXXXXXXXXX":'return too quickly when we use it
  79. if fail2$="" THEN fail2$="XXXXXXXXXXX":'later in this routine
  80. '
  81. TOPW 1:SEND prefix$+set$("DIALDIR",entry$,"#"):' dial the GEnie number
  82. WAIT timeout,con1$,con2$,fail1$,fail2$
  83. IF WAIT(0)=3 OR WAIT(0)=4 THEN
  84.     TOPW:PRINT "Error: GEnie didn't answer";chr$(7):GOTO EXIT
  85. ENDIF
  86. IF CARRIER=FALSE THEN
  87.     TOPW:PRINT "Error: No carrier. (didn't answer?)";chr$(7):GOTO EXIT
  88. ENDIF
  89. '
  90. SEND "HHH";
  91. WAIT 20,"U#=":REM Wait 20 seconds for prompt
  92. IF WAIT(0)=0 THEN TOPW :PRINT "Logon Failed";:PRINT chr$(7):GOTO EXIT
  93. DUPLEX FULL :'so password doesn't appear on screen
  94. SEND acct$+","+pwd$+","+mid$(c$(dest),2):' strip "M" off dest$
  95. ' The pause ensures that the password is sent before duplex is switched back
  96. PAUSE 2:DUPLEX HALF
  97. WAIT 30,"continue?":' welcome menu prompt
  98. SEND "":' skip it. We're now moving to our destination
  99. '
  100. RETURN
  101. '
  102. ' == DATA AREA ==
  103. DATA 5
  104. DATA "  Library ","M475;3"
  105. DATA "  BB ","M475;1"
  106. DATA "  RTC ","M475;2"
  107. DATA "  Mail ","M200"
  108. DATA "  <cancel>",""
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.